package sysu.el.array.doubles.functors;

public abstract class Fun2Double {
	public abstract double apply(double p1, double p2);
	
	static public Fun2Double plus = new Fun2Double(){
		@Override
		public double apply(double p1, double p2) {
			return p1 + p2;
		}
	};
	
	static public Fun2Double minus = new Fun2Double(){
		@Override
		public double apply(double p1, double p2) {
			return p1 - p2;
		}
	};
	
	static public Fun2Double multiply = new Fun2Double(){
		@Override
		public double apply(double p1, double p2) {
			return p1 * p2;
		}
	};
	
	static public Fun2Double divide = new Fun2Double(){
		@Override
		public double apply(double p1, double p2) {
			return p1 / p2;
		}
	};
	
	static public Fun2Double min = new Fun2Double(){
		public double apply(double p1, double p2) {
			// TODO Auto-generated method stub
			if (p1 <= p2)
				return p1;
			else return p2;
		}
	};
	
	static public Fun2Double max = new Fun2Double(){
		public double apply(double p1, double p2) {
			// TODO Auto-generated method stub
			if (p1 >= p2)
				return p1;
			else return p2;
		}
	};
}